package com.way.Java多线程编程核心技术v2.chapter02_对象及变量的并发访问._2_2_synchronized同步语句块.多个锁就是异步执行;

/**
 * @PROJECT_NAME: my-projects
 * @DESCRIPTION:
 * @USER: 魏彪
 * @DATE: 2023/11/29 14:48
 */
public class Test {

    public static void main(String[] args) {
        Service02 s02 = new Service02();

        // 由于锁不同，所以运行结果是异步的
        Thread01 t01 = new Thread01(s02);
        t01.setName("A");
        t01.start();

        Thread02 t02 = new Thread02(s02);
        t02.setName("B");
        t02.start();
    }
}
